problem in `delete-directory` with enabled `delete-by-removing-to-trash`

Posted by Andreo on Stack Overflow See other posts from Stack Overflow or by Andreo
Published on 2010-04-06T08:33:39Z Indexed on 2010/04/10 13:33 UTC
Read the original article Hit count: 192

Filed under:
|
|

There is a strange behavior of delete-directory function with enabled flag delete-by-removing-to-trash. It deletes files one by one instead of applying move-file-to-trash to the directory. As a result emacs deletes big directories slowly and there are many files in the trash after deleting, so it is impossible to restore the directory.

Example: Directory structure:

ddd/
   ccc/
       1.txt

There are three files in the trash after deleting ddd:

trash/
    ddd/
    ccc/
    1.txt

instead of one:

trash/
    ddd/
  • It is very slow, because emacs traverse directory recursively.
  • I can't restore deleted directory.

What i need is exactly the same behavior as of move-file-to-trash. But it should be transparent (i.e. 'D x' in dired mode). How to solve the problem? As a temporary solution i see the making advice function for `delete-directory'.

© Stack Overflow or respective owner

Related posts about emacs

Related posts about elisp